package mercury.util;

import java.net.Authenticator;
import java.net.InetAddress;
import java.net.PasswordAuthentication;

public class CustomAuthenticator extends Authenticator {
	  String username = "";
	  String password = "";
	  public CustomAuthenticator(String user,String pwd) {
		  username = user;
		  password = pwd;
	  }
    // This method is called when a password-protected URL is accessed
    protected PasswordAuthentication getPasswordAuthentication() {
        // Get information about the request
        String promptString = getRequestingPrompt();
        String hostname = getRequestingHost();
        InetAddress ipaddr = getRequestingSite();
        int port = getRequestingPort();

        
        // Return the information
        return new PasswordAuthentication(username, password.toCharArray());
    }
}